package com.cookbook.service.impl;

import com.cookbook.database.data.TipsMapper;
import com.cookbook.database.model.Tips;
import com.cookbook.service.MessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 毛川
 */
@Service
public class MessageServiceImpl implements MessageService {
    @Autowired
    TipsMapper tipsMapper;


    @Override
    public List<Tips> select(int page, int limit) throws Exception {
        int offset = page * limit;
        return tipsMapper.selectWithOffset(offset, limit);
    }

    @Override
    public void insert(Tips tip) throws Exception {
        tipsMapper.insert(tip);
    }
}
